package handler

import (
	"gateway/config"
	"gateway/core"
	"go.uber.org/zap"
)

const (
	JSON_PATH = "jsonPath"
	KEY       = "key"
	EQUAL     = "="
)

func getHandlerFunc(name string) func(string) core.Handler {
	switch name {
	case "jsonPathHandler":
		return newJsonPathHandler
	default:
		return nil
	}
}

func NewHandler(name string) core.Handler {
	f := getHandlerFunc(name)
	if f == nil {
		config.Logger.Panic("Handler not found", zap.String("name", name))
	}
	return f(name)
}
